# !/bin/bash
# clean buff/cache
# author: hobby

echo "Start cleaning buff/cache"

# 将所有未写的系统缓冲区写到磁盘中
sudo sync;sync;sync
#延迟5秒
sleep 5
# 释放页缓存
sudo echo 1 > /proc/sys/vm/drop_caches
# 释放dentries和inodes
sudo echo 2 > /proc/sys/vm/drop_caches
# 释放所有缓存
sudo echo 3 > /proc/sys/vm/drop_caches

echo "cleaning ending......"